//
//  WrokTimeTableViewController.swift
//  HuaYun
//
//  Created by enghou on 2019/1/11.
//  Copyright © 2019 xyxorigation. All rights reserved.
//

import UIKit

class WrokTimeTableViewController: UITableViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        self.tableView.backgroundColor = UIColor.dftBack
    }

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.navigationItem.hidesBackButton = true
        let back = UIBarButtonItem.init(image: UIImage.init(named: "icon_nav_whiteback")!.withRenderingMode(.alwaysOriginal), style: .plain, target: self, action: #selector(pop))
        back.tintColor = .white
        self.navigationItem.leftBarButtonItem = back
        
//        self.navigationController?.navigationBar.tintColor = UIColor.white
//        self.navigationController?.navigationBar.barTintColor = UIColor.white
//        self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white]
//        self.navigationController?.navigationBar.setBackgroundImage(UIColor.hex("2b89df").image(size: CGSize(width: UIScreen.main.bounds.size.width, height: 64)), for: .default)
    }
    
    override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
        return 10
    }
    
    override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
        let view = UIView()
        view.backgroundColor = UIColor.dftBack
        return view
    }
    
    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        switch indexPath.section {
        case 0:
            let work = MyWorkTimeViewController()
            work.title = "工时管理"
            self.push(destination: work)
            break
        case 1:
            let depart = DepartmentWorkTimeViewController()
            depart.title = "部门工时统计"
            self.push(destination: depart)
            break
        case 2:
            let proj = ProjectWorkTimeViewController()
            proj.title = "项目工时统计"
            self.push(destination: proj)
            break
        default:
            let employee = EmployeeTimeViewController()
            employee.title = "人员工时统计"
            self.push(destination: employee)
            break
        }
    }
    
}
